package com.sensetime.audiodeocde;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import java.io.File;

public class MainActivity extends AppCompatActivity {
    String TAG = "MainActivity";
    String fileOgg = "test.ogg";
    String fileMp3 = "two_tiger.mp3";
    String fileAcc = "two_tiger.aac";
    String fileWav = "voice_1.wav";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        FileUtils.copyFileToExternal(getApplicationContext(), fileOgg );
        FileUtils.copyFileToExternal(getApplicationContext(), fileMp3 );
        FileUtils.copyFileToExternal(getApplicationContext(), fileAcc );
        FileUtils.copyFileToExternal(getApplicationContext(), fileWav );
        findViewById(R.id.convert).setOnClickListener(v->{
            //acc没问题，ogg就不行
            File file = new File(getExternalFilesDir(null), fileOgg);
            if(file.exists()){
                new DecodeAACThread(MainActivity.this, file.getAbsolutePath()).start();
            }else{
                Log.e(TAG, "文件不存在！");
            }
        });

    }
}